// solver_with_funcpointers.cpp : Defines the entry point for the console application.
//
#include <iostream>
#include <istream>

#include "Expression.h"
using namespace std;


#include "stdafx.h"
#include "stdlib.h"



int _tmain(int argc, _TCHAR* argv[])
{
	int a=1, b=2, c=3, d=4, e=5, f=6, exp_size = 3;
	char OP, InputType[2], bracket;

	cout << "number of boxes: ";
	cin >> exp_size;
	Expression Exp(exp_size);
	int *inputs;
	inputs = new int(exp_size);


	for(int i = 0; i<exp_size;i++)
	{
		cout << (int)i+1 << ". kifejezes : ";
		cin >> InputType[0] >> (inputs[i*2]) >> OP >> InputType[1] >> (inputs[i*2+1]) ;
		

		if(InputType[0] == 'A' || InputType[0] == 'a')
		{
			Exp.E[i].SetA(&Exp.E[(inputs[i*2])-1]);
		}
		else if (InputType[0] == 'D' || InputType[0] == 'd')
		{
			Exp.E[i].SetA(&(inputs[i*2]));
		}

		if (InputType[1] == 'A' || InputType[1] == 'a' )
		{
			Exp.E[i].SetB(&Exp.E[(inputs[i*2+1])-1]);
		}
		else if(InputType[1] == 'D' || InputType[1] == 'd')
		{
			Exp.E[i].SetB(&(inputs[i*2+1]));
		}

		Exp.E[i].SetOp(OP);
	}
	
	Exp.Solve();
	f=Exp.GetResult();
	
	for(int i = 0; i<exp_size; i++)
	{
		cout << *(Exp.E[i].a) << Exp.E[i].OperatorSign << *(Exp.E[i].b) << " = " <<  *(Exp.E[i].c) <<  "        next" << endl;
	}
	
	cout << "Eredmeny: " << Exp.GetResult() << endl;

	char wait;
	//delete[] inputs;
	cin >> wait;
	return 0;
}
















int CommandProcess(ExpressionContainer *expressions, int NOEC)
{
	for(int i=0; i<NOEC; i++)
	{
		expressions[i].Solve();
	}
	
	return 0;
}
